<?php
//url
$url_create_offer = Yii::app()->createUrl('/offer/form');

$total = $row['number'];
if ($total == 0) {
?>
<div class="well well-large gray">
	<h3 class=""><?php echo BUtils::T('customers_no_people_lbl'); ?></h3>
</div>
<?php
} else {
	if ($total > 9) $percent = 90;
	else $percent = $total * 10; //convert to n%.
	
	$number_html = '<strong id="people-number" class="green" style="font-size:20px;">' . $total . '</strong>';
?>
<div class="row-fluid">
	<div class="span7">
		<div class="alert alert-block alert-info">
			<p>
				<?php echo BUtils::T('customers_nearby_msg', array('{number}'=>$number_html)) ?>
			</p>
			<p>
				<a class="btn btn-info" href="<?php echo $url_create_offer; ?>?ref=people_nearby"><?php echo BUtils::T('create_offer_lbl'); ?></a>
			</p>
		</div>
	</div>
	<div class="span5" style="text-align:center; padding:10px 0;">
		<div class="easy-pie-chart percentage" data-size="128" data-percent="<?php echo $percent; ?>" data-color="#adc95a">
			<span class="percent" style="font-size:36px; color:#adc95a"><?php echo $total; ?></span>
		</div>
	</div>
</div>
<?php } ?>
<script>
$(function() {	
	//set pie charts
	var oldie = $.browser.msie && $.browser.version < 9;
	$('.easy-pie-chart.percentage').each(function(){
		var $box = $(this).closest('.infobox');
		var barColor = $(this).data('color') || (!$box.hasClass('infobox-dark') ? $box.css('color') : 'rgba(255,255,255,0.95)');
		var trackColor = barColor == 'rgba(255,255,255,0.95)' ? 'rgba(255,255,255,0.25)' : '#E2E2E2';
		var size = parseInt($(this).data('size')) || 50;
		$(this).easyPieChart({
			barColor: barColor,
			trackColor: trackColor,
			scaleColor: false,
			lineCap: 'butt',
			lineWidth: parseInt(size/8),
			animate: oldie ? false : 1000,
			size: size
		});
	})
});
</script>